package com.rd.student.jike.class1.sunhao.day02;

import java.util.LinkedList;
import java.util.Scanner;

public class ManagerSystem {

    public static void main(String[] args) {
        Student s1 = new Student(1,"孙昊","计科",1,"哈哈",20,500);
        Student s2 = new Student(2,"方周","计科",1,"哈哈",25,500);
        Student s3 = new Student(3,"姜万里","计科",1,"哈哈",10,500);
        Student s4 = new Student(4,"郭佳宝","计科",1,"哈哈",22,500);
        Student s5 = new Student(5,"高晨曦","软件",3,"哈哈",17,500);
        Student s6 = new Student(6,"张思涛","软件",3,"哈哈",19,500);

        LinkedList linkedList = new LinkedList();
        linkedList.add(s1);
        linkedList.add(s2);
        linkedList.add(s3);
        linkedList.add(s4);
        linkedList.add(s5);
        linkedList.add(s6);
        String str;String str1;String str2;
        int i1;int i2;int i3;
        Scanner scanner = new Scanner(System.in);
        int num=001;
        int o;
        int i;
        while(true){
            System.out.println("查看小组成员请输入0");
            System.out.println("新增小组成员请输入1");
            System.out.println("移除小组成员请输入2");
            System.out.println("根据班级查询成员列表请输入3");
            System.out.println("根据专业查询成员列表请输入4");
            System.out.println("根据年龄查询成员列表请输入5");
            System.out.println("返回所有成员名字请输入6");
            System.out.println("计算成员的平均年龄请输入7");
            System.out.println("根据年龄范围返回成员列表请输入8");
            System.out.println("******************************************************");
            i=scanner.nextByte();

                switch (i) {
                    case 0:
                        System.out.println("返回上一级请输入9，继续请输入1");
                        o=scanner.nextByte();
                        if (o==9)
                            break;
                        System.out.println("查看成员：");
                        Selectmember.sem(linkedList);
                        System.out.println("返回上一级请输入9");
                        o=scanner.nextInt();
                        if (o==9)
                            break;
                    case 1:
                        System.out.println("返回上一级请输入9，继续请输入1");
                        o=scanner.nextByte();
                        if (o==9)
                            break;
                        //int num, String name, String major, int cla, String desc, int age, int codeName
                        System.out.println("添加成员：");
                        System.out.println("请输入姓名（string）");
                        str = scanner.next();
                        System.out.println("请输入职务（string）");
                        str1 = scanner.next();
                        System.out.println("请输入班级（int）");
                        i1 = scanner.nextByte();
                        System.out.println("请输入描述（string）");
                        str2 = scanner.next();
                        System.out.println("请输入年龄（int）");
                        i2 = scanner.nextByte();
                        System.out.println("请输入codeName");
                        i3 = scanner.nextInt();
                        linkedList.add(AddUtils.addUtils(num,str,str1,i1,str2,i2,i3));
                        num++;
                        System.out.println("返回上一级请输入9");
                        o=scanner.nextByte();
                        if (o==9)
                            break;
                    case 2:
                        System.out.println("返回上一级请输入9，继续请输入1");
                        o=scanner.nextByte();
                        if (o==9)
                            break;
                        System.out.println("想通过学号删除请按“1”，想通过姓名删除请按“2”");
                        int w;
                        w=scanner.nextByte();
                        if (w==1)
                        {System.out.println("请输入学号");
                            int e=scanner.nextByte();
                            RemoveUtils.rU(linkedList,e);}
                        else
                            if(w==2){
                                System.out.println("请输入学号");
                                String e=scanner.next();
                                RemoveUtils.rU(linkedList,e);
                            }else
                                System.out.println("输入错误！");
                        System.out.println("返回上一级请输入9");
                        o=scanner.nextByte();
                        if (o==9)
                            break;
                    case 3:
                        System.out.println("返回上一级请输入9，继续请输入1");
                        o=scanner.nextByte();
                        if (o==9)
                            break;
                        GetlistUtils.Glu1(linkedList);
                        System.out.println("返回上一级请输入9");
                        o=scanner.nextByte();
                        if (o==9)
                            break;
                    case 4:
                            System.out.println("返回上一级请输入9，继续请输入1");
                            o=scanner.nextByte();
                            if (o==9)
                                break;
                            System.out.println("请输入专业");
                            String major=scanner.next();
                            GetlistUtils.Glu2(linkedList,major);
                            System.out.println("返回上一级请输入9");
                            o=scanner.nextByte();
                            if (o==9)
                                break;
                    case 5:
                        System.out.println("返回上一级请输入9，继续请输入1");
                        o=scanner.nextByte();
                        if (o==9)
                            break;
                        System.out.println("根据年龄输出：");
                        GetlistUtils.Glu3(linkedList);
                        System.out.println("返回上一级请输入9");
                        o=scanner.nextByte();
                        if (o==9)
                            break;
                    case 6:
                        System.out.println("返回上一级请输入9，继续请输入1");
                        o=scanner.nextByte();
                        if (o==9)
                            break;
                        System.out.println("根据姓名输出：");
                        GetlistUtils.Glu4(linkedList);
                        System.out.println("返回上一级请输入9");
                        o=scanner.nextByte();
                        if (o==9)
                            break;
                    case 7:
                        System.out.println("返回上一级请输入9，继续请输入1");
                        o=scanner.nextByte();
                        if (o==9)
                            break;
                        AverageName.AN(linkedList);

                        System.out.println("返回上一级请输入9");
                        o=scanner.nextByte();
                        if (o==9)
                            break;
                    case 8:
                        System.out.println("返回上一级请输入9，继续请输入1");
                        o=scanner.nextByte();
                        if (o==9)
                            break;
                        AverageName.NianLinngDuan(linkedList);

                        System.out.println("返回上一级请输入9");
                        o=scanner.nextByte();
                        if (o==9)
                            break;

                }

        }
    }
}
